Skip to main content

Debugging and diagnosing automation issues

3 Tasks

40 mins

Visible to: All users
Beginner Pega Robotic Automation 22.1 Robotic Process Automation English

Scenario

The testing team receives a timeout error when testing the login automation using incorrect credentials. To better inform the user and display a user-friendly message, use the debugging and diagnostics tools to add robust error handling, including a specific error message for when someone enters the wrong credentials added to the Pega Runtime log.

Complete the following objectives:

  • Edit the Main Automation, run in Test mode, add breakpoints to the BI_Login automation, and follow the data values to view the error.
  • Add error handling to capture and display the error in the logs.
  • Ensure the project demonstrates the appropriate logging message when testing for incorrect login credentials.

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Reproduce the issue in the Banker Insight application

  1. Download the Robotic Banking project:
  2. Open the project in Pega Robot Studio.
  3. On the Project tab, click Main automation to open the automation.
    Screenshot showing Main automation selected in Robot Studio
  4. In the upper-right corner of the standard toolbar, expand the Test button, and select Run all to begin the debugging process.
    Choose Run all to begin testing
  5. Once the login popup is visible, watch the login process and wait until you see a message that reads:  Application Timeout.
    Application timeout message window
  6. Click OK to close the timeout message.
  7. In the upper-right corner of the standard toolbar, click Stop to end debugging of the automation.

2 Turn on logging and add error handling to log the error message

  1. In the top menu of Robot Studio, click Tools > Options.
    Select Options from Tools menu
  2. In the Options pop-up window, on the Runtime diagnostics tab, in the Automation list, select Error to turn on logging only for errors in the Automation category.
    Choosing Error from logging options
  3. Click Done to close the Options pop-up window.
  4. Navigate to the project screen and click BI_Login to open the automation.
  5. Between the frmBankerInsight WaitForCreate design blocks and the JumpTo Failure design block, click the connector to select the data link, and then press the Delete key to remove the link.
    In the Automation removing the connector link from the frmBankerInsight and the JumpTo Failure design blocks
  6. Drag the JumpTo Failure design block off to the side of the automation to make more room for the next steps.
  7. On the Palette, open BankerInsight1 > LoginForm and drag the errorNotification label to the automation design area.
    The system displays the Properties, Methods, and Events dialog box.
  8. In the Properties, Methods, and Events dialog box, click More > Properties > Visible, and then click Add to add the Text property to the automation design area. 
    Visible property from Properties, methods and events window
  9. In the Palette, drag the errorNotification label onto the automation design area, click More > Properties > Text, and then click Add to add it to the automation.
    Adding the errorNotification Text property and Visible property to the automation
  10. In the toolbox, select Toolbox > Utilities> Logs  to open the logging options.
    Displaying the Log options in Utilities folder of the toolbox
  11. Select the Log Error utility, then drag it onto the automation surface to add it to the automation.
    Added WriteLog design block next errorNotification to automation
  12. Once you add the Log design block to the automation, click the Category field and enter Automation.
  13. Edit the following design blocks:

Failure label

  1. On the Failure label, click the + button to add a parameter.
  2. On the parameter list, change the String parameter name to msg.
  3. On the Failure exit point, click the + button to add a parameter.
  4. On the parameter list, change the String parameter name to msg.
    The output parameter will also be automatically added to the Success exit point.

 

 

  1. On the automation surface, right-click the automation surface to add another Jump To Failure design block next to the Log text block. 

    added a JumpTo design block next to the WriteLog design block
  2. In the Jump To Failure block connected to frmBankerInsight WaitForCreate, click msg and enter Application timeout to set an error message.
  3. Ensure that you have connected the design blocks, as shown in the following image:
    Updated BI_Login automation with new errorNotification properties and JumpTo blocks for additional error handling.
  4. In the upper-left corner of the standard toolbar, click Save to save your changes.

3 Test and debug the automation

  1. In the BI_Login automation, click the connector to select the data link between the Run block and the txtUserName design block.
  2. On the automation surface, right-click the data link, and then select Toggle breakpoint to add a breakpoint to your automation.
    Toggle breakpoint on connector link on Run design block
  3. In the upper-right corner of the standard toolbar, click Test to begin the debugging process in Test mode.
  4. In the Testing model dialog box, enter the following variables:

Username

Password

pega

sega

  1. Click Test.
  2. In the upper-right corner of the standard toolbar click the Step-Into icon to view the username data value update in the design block.
Tip: Instead of clicking the Step-Into icon, you can press the F11 key on your keyboard.
Highlighting the Step-into icon on the menu
  1. Click the Step-Into icon once again to advance past the btnLogin PerformClick block.
  2. Once the frmBankerInsight WaitForCreate block proves false, verify that the errorNotification Visible property is True.
    In Test mode, showing errorNotification property block as True
  3. Click the Step-Into icon until you can verify that the Log block contains the error text.
    WriteLog design block message value set to Invalid Credentials message
  4. Click Continue to advance to the Failure label and end the testing.
  5. Click Done to end Test mode.
    Click the Done button testing is complete

Confirm your work

  1. Click the Main automation tab to reopen the BankerInsight main automation.
  2. Right-click the Application timeout text in the MessageBox design block and select Reset changes to clear the value.
  3. Click the msg variable and add a connector link from the BI_Login to the message variable in the MessageBox.
  4. Click the connector link between the frmLoginForm Created and BI_Login design blocks to select the automation link.
  5. On the automation surface, right-click the data link, and then select Toggle breakpoint.
    Adding the breakpoint in the Main automation for testing
  6. In the upper-right corner, to the right of Test, click the arrow, and then select Run all.
  7. Press the green Continue button to verify that the error text message passes to, and then displays in, a Message dialog box
  8. On the message box, click OK to dismiss the message.
    Invalid credentials window popup during testing mode
  9. In the upper-right corner, click Stop to end debugging.
    Stop button from debugging menu
  10. Select Tools > Shortcuts> Files > Pega Runtime Log in the top menu.
    Selected Pega Runtime log from the Tools > Shortcuts > Files menu
  11. Verify that the new Error log entry is there.
    New Error entry displayed in Pega Runtime log


If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice